package com.rapid.maintenance.ui.activity.productmall;

import android.content.Intent;
import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.rapid.maintenance.R;
import com.rapid.maintenance.adapter.ProductMallBusinessAdapter;
import com.rapid.maintenance.adapter.ProductMallProductAdapter;
import com.rapid.maintenance.base.BaseActivity;

import java.util.ArrayList;

import butterknife.BindView;


public class ProductMallMainActivity extends BaseActivity {
    @BindView(R.id.rv_specials)
    RecyclerView rvSpecials;
    @BindView(R.id.rv_flash_sale)
    RecyclerView rvFlashSale;
    @BindView(R.id.rv_business)
    RecyclerView rvBusiness;
    ProductMallBusinessAdapter productMallBusinessAdapter;
    ProductMallProductAdapter specialsAdapter;
    ProductMallProductAdapter flashSaleAdapter;

    @Override
    protected int provideRootLayout() {
        return R.layout.activity_product_mall_main;
    }

    @Override
    protected void init() {
        setTitle("产品商城首页");
        setStatusBarColor(0xFF016DB6);
        setToolBarColor(0xFF016DB6);

        rvBusiness.setLayoutManager(new LinearLayoutManager(this));
        rvBusiness.setAdapter(productMallBusinessAdapter = new ProductMallBusinessAdapter());
        rvFlashSale.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
        rvSpecials.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
        rvFlashSale.setAdapter(flashSaleAdapter = new ProductMallProductAdapter(true));
        rvSpecials.setAdapter(specialsAdapter = new ProductMallProductAdapter(false));
        ArrayList<Object> objects = new ArrayList<>();
        objects.add(new Object());
        objects.add(new Object());
        objects.add(new Object());
        specialsAdapter.setNewData(objects);
        specialsAdapter.setOnItemClickListener((adapter, view, position) -> startActivity(ProductMallProductDetailActivity.class));
        flashSaleAdapter.setOnItemClickListener((adapter, view, position) -> startActivity(ProductMallProductDetailActivity.class));
        flashSaleAdapter.setNewData(objects);
        productMallBusinessAdapter.setNewData(objects);
        productMallBusinessAdapter.setOnItemClickListener((adapter, view, position) -> startActivity(ProductMallBusinessMainActivity.class));
    }

    @Override
    protected void initializationData(Intent intent) {
        super.initializationData(intent);
    }
}
